package baoxin.com.robotcoach;

import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.widget.ImageButton;
import android.widget.ImageView;

public class FocuseImageView extends ImageView {
    public FocuseImageView(Context context) {
        super(context);
    }
    public FocuseImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFocusChanged(boolean gainFocus, int direction, @Nullable Rect previouslyFocusedRect) {
        super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
        if (gainFocus){
            scaleUp();
        }else{

        }
    }

    private void scaleUp(){
        ViewCompat.animate(this).scaleX(1.5f).scaleY(1.5f).translationZ(1).start();
    }
}
